<h2><?php  __('Datos del Recibo de Cobranza');?></h2>
<div class="reciboCobranzas view">
 <table border="0">
            <tr>
                <td width="96" align="left">Tipo Doc.</td>
                <td colspan="8" align="left"><?php echo $reciboCobranza['ReciboCobranza']['codigo_documento_ref_id'];?>&nbsp;</td>
  </tr>
            <tr>
                <td align="left">Documento</td>
                <td width="17" align="left"><?php  
                    if ($reciboCobranza['ReciboCobranza']['codigo_documento_ref_id']==101)
                        $con = 'Facturas';
                    else if($reciboCobranza['ReciboCobranza']['codigo_documento_ref_id']==103)
                        $con = 'Boletas';
                    else if($reciboCobranza['ReciboCobranza']['codigo_documento_ref_id']==108)
                        $con = 'NotaDebito';
                    else if($reciboCobranza['ReciboCobranza']['codigo_documento_ref_id']==125)
                        $con = 'Convenios';
                    else
                        $con = '';

                    if ($con=='')
                        echo $reciboCobranza['DocumentoReferencia']['numero_documento'];
                    else if ($con=='Convenios')
                        echo $html->link($reciboCobranza['Convenio']['numero_documento'],
                            array('controller'=>$con, 'action'=>'view', $reciboCobranza['ReciboCobranza']['documento_referencia_id']),
                            array('target'=>'blank')
                        );
                    else
                        echo $html->link($reciboCobranza['DocumentoReferencia']['numero_documento'],
                            array('controller'=>$con, 'action'=>'view', $reciboCobranza['ReciboCobranza']['documento_referencia_id']),
                            array('target'=>'blank')
                        );
                ?></td>
                <td width="79" align="left">Fecha</td>
                <td colspan="6" align="left"><?php echo $time->format('d/m/Y', $con == 'Convenios'?$reciboCobranza['Convenio']['fecha_emision']:$reciboCobranza['DocumentoReferencia']['fecha_emision']);?>&nbsp;</td>
  </tr>
            <tr>
                <td align="left">Cliente</td>
                <td align="left"><?php echo $html->link($reciboCobranza['Cliente']['codigo'],
                        array('controller'=>'Clientes', 'action'=>'view', $reciboCobranza['Cliente']['id']),
                        array('target'=>'blank')
                );?></td>
                <td colspan="7" align="left"><?php echo $reciboCobranza['ReciboCobranza']['nombre_cliente'];?></td>
  </tr>
            <tr>
                <td align="left">Vendedor Orig.</td>
                <td align="left"><?php echo $html->link($reciboCobranza['VendedorOrigen']['codigo'],
                        array('controller'=>'Vendedores', 'action'=>'view', $reciboCobranza['VendedorOrigen']['id']),
                        array('target'=>'blank')
                );?></td>
                <td colspan="7" align="left"><?php echo $reciboCobranza['VendedorOrigen']['Tercero']['razon_social'];?></td>
  </tr>
            <tr>
              <td align="left">Cobrado por</td>
              <td align="left"><?php echo $html->link($reciboCobranza['Vendedor']['codigo'],
                        array('controller'=>'Vendedores', 'action'=>'view', $reciboCobranza['Vendedor']['id']),
                        array('target'=>'blank')
                );?></td>
              <td colspan="7" align="left"><?php echo $reciboCobranza['Vendedor']['Tercero']['razon_social'];?></td>
  </tr>
            <tr>
              <td align="left">Recibo</td>
              <td align="left"><?php echo '111';?>&nbsp;</td>
              <td align="left"><?php echo $reciboCobranza['ReciboCobranza']['numero_documento'];?></td>
              <td width="47" align="left">Fecha</td>
              <td width="71" align="left"><?php echo $time->format('d/m/Y', $reciboCobranza['ReciboCobranza']['fecha']);?>&nbsp;</td>
              <td width="65" align="left">Moneda</td>
              <td width="19" align="left"><?php echo $reciboCobranza['Moneda']['simbolo'];?>&nbsp;</td>
              <td width="111" align="right">T.Cambio</td>
              <td width="89" align="left">: <?php echo $reciboCobranza['ReciboCobranza']['tipo_cambio'];?>&nbsp;</td>
  </tr>
            <tr>
              <td align="left">Importe</td>
              <td align="left"><?php echo $number->format($reciboCobranza['ReciboCobranza']['monto_recibido'], array(
                    'places'=>2,
                    'before'=>'',
                    'thousands'=>''
                ));?></td>
              <td align="left">&nbsp;</td>
              <td align="left">Cheque</td>
              <td align="left"><?php echo $reciboCobranza['ReciboCobranza']['numero_cheque'];?></td>
              <td align="left">Banco</td>
              <td colspan="3" align="left"><?php echo $reciboCobranza['Banco']['descripcion'];?></td>
  </tr>
            <tr>
              <td align="left">Observ.</td>
              <td colspan="4" align="left"><?php echo $reciboCobranza['ReciboCobranza']['observaciones'];?>&nbsp;</td>
              <td align="left">Estado</td>
              <td align="left"><?php echo $reciboCobranza['ReciboCobranza']['activo']?'ACTIVO':'';?></td>
              <td align="right">Efvo. en vtnilla</td>
              <td align="left">: <?php echo $reciboCobranza['ReciboCobranza']['en_ventanilla']?'SI':'NO';?></td>
  </tr>
</table>
 <table border="1px">
     <tr>
               <th width="200">Saldo de Cuenta Corriente</th>
               <th width="161">Controles</th>
    </tr>
            <tr>
                <td><table style="border: 0; width:200px;">
                  <tr style="border: 0;">
                    <td style="border: 0;" align="right">Total Doc.</td>
                    <td style="border: 0;" align="right"><?php echo $number->format($con == 'Convenios'?$reciboCobranza['Convenio']['suma_importe_total']:$reciboCobranza['DocumentoReferencia']['cargo'], array(
                                'places'=>2,
                                'before'=>'',
                                'thousands'=>''
                            ));?></td>
                  </tr>
                  <tr>
                    <td align="right">Tot. Abonos</td>
                    <td align="right"><?php echo $number->format($con == 'Convenios'?($reciboCobranza['Convenio']['pagado']?$reciboCobranza['Convenio']['suma_importe_total']:0):$reciboCobranza['DocumentoReferencia']['abono'], array(
                                'places'=>2,
                                'before'=>'',
                                'thousands'=>''
                            ));?></td>
                  </tr>
                  <tr style="border: 0;" align="right">
                    <td style="border: 0;">Saldo Doc.</td>
                    <td style="border: 0;" align="right"><?php echo $number->format($con == 'Convenios'?($reciboCobranza['Convenio']['pagado']?0:$reciboCobranza['Convenio']['suma_importe_total']):($reciboCobranza['DocumentoReferencia']['cargo']-$reciboCobranza['DocumentoReferencia']['abono']), array(
                                'places'=>2,
                                'before'=>'',
                                'thousands'=>''
                            ));?></td>
                  </tr>
                </table></td>
                <td><table style="border: 0;" align="center">
                  <tr style="border: 0;">
                    <td style="border: 0;"></td>
                    <td style="border: 0;" align="center">Documento</td>
                  </tr>
                  <tr style="border: 0;">
                    <td style="border: 0;" align="right">Importe Doc.</td>
                    <td style="border: 0;" align="right"><?php echo $number->format($con == 'Convenios'?$reciboCobranza['Convenio']['suma_importe_total']:$reciboCobranza['DocumentoReferencia']['suma_importe_total'], array(
                                'places'=>2,
                                'before'=>'',
                                'thousands'=>''
                            ));?></td>
                  </tr>
                  <tr style="border: 0;">
                    <td style="border: 0;" align="right">Total Abonos</td>
                    <td align="right"><?php echo $number->format($reciboCobranza['DocumentoReferencia']['suma_abono_cc'], array(
                                'places'=>2,
                                'before'=>'',
                                'thousands'=>''
                            ));?></td>
                  </tr>
                  <tr style="border: 0;">
                    <td style="border: 0;" align="right">Saldo Actual</td>
                    <td style="border: 0;" align="right"><?php echo $number->format($reciboCobranza['DocumentoReferencia']['suma_saldo_documento_cc'], array(
                                'places'=>2,
                                'before'=>'',
                                'thousands'=>''
                            ));?></td>
                  </tr>
                </table></td>
            </tr>
</table>
  <div class="actions" style="padding:5px 0 5px 0;">
        <?php echo $html->link(__('Volver', true), array('action' => 'index'), array('class'=>'lnkbutton btnback')); ?>
        <?php echo $html->link(__('Nuevo', true), array('action' => 'add'), array('class'=>'lnkbutton btnnew')); ?>
        <?php echo $html->link(__('Editar', true), array('action' => 'edit', $reciboCobranza['ReciboCobranza']['id']), array('class'=>'lnkbutton btnedit')); ?>
        <?php echo $html->link(__('Eliminar', true), array('action' => 'delete', $reciboCobranza['ReciboCobranza']['id']), array('class'=>'lnkbutton btnerase'), sprintf(__('Are you sure you want to delete # %s?', true), $reciboCobranza['ReciboCobranza']['id'])); ?>
        <?php 
	if(!empty($vecino['prev'])){
		echo $html->link('Atrás', array('action'=>'view',$vecino['prev']['ReciboCobranza']['id']), array('class'=>'lnkbutton btnprev'));	
    }
    if(!empty($vecino['next'])){
		echo $html->link('Siguiente', array('action'=>'view',$vecino['next']['ReciboCobranza']['id']), array('class'=>'lnkbutton btnnext'));
	}
	 ?>
    </div>
</div>